package pers.zyl.fund.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

@RestController
@RequestMapping("/fund")
public class AccountController {
    @PostMapping("/account/balance/{userId}/{amount}")
    public String deductingBalance(
            @PathVariable("userId") Long userId,
            @PathVariable("amount") BigDecimal amount,
            HttpServletRequest request

    ) {
        return String.format("端口:%s, user: %s, amount: %s", String.valueOf(request.getServerPort()), userId.toString(), amount);
    }
}
